package webbrow.search.model;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;

import webbrow.board.vo.BoardSpringVO;

public class SearchDaoImpl implements SearchDao {
	private SqlSessionTemplate sqlSessionTemplate;
	public SearchDaoImpl(SqlSessionTemplate sqlSessionTemplate){
		super();
		this.sqlSessionTemplate=sqlSessionTemplate;
	}
	@Override
	public List<BoardSpringVO> searchContentByTitle(SearchCommand command) throws Exception{
		System.out.println("dao에 keyword 들어오는지 test : "+command);
		return this.sqlSessionTemplate.selectList("search.searchContentByTitle",command);
	}
	@Override
	public List<BoardSpringVO> searchContentByWriter(SearchCommand command) throws Exception{
		System.out.println("dao impl 값"+command);
		return this.sqlSessionTemplate.selectList("search.searchContentByWriter",command);
	}
	
	@Override
	public List<BoardSpringVO> searchContentByContent(SearchCommand command) throws Exception{
		return this.sqlSessionTemplate.selectList("search.searchContentByContent",command);
	}

	@Override
	public List<BoardSpringVO> searchContentByTitleContent(SearchCommand command) throws Exception{
		return this.sqlSessionTemplate.selectList("search.searchContentByTitleContent",command);
	}
	@Override
	public int selectTitlePostingCount(String keyword) throws Exception{
		return this.sqlSessionTemplate.selectOne("search.selectTitlePostingCount",keyword);
	}
	@Override
	public int selectWriterPostingCount(String keyword) throws Exception {
		return this.sqlSessionTemplate.selectOne("search.selectWriterPostingCount",keyword);
	}
	@Override
	public int selectContentPostingCount(String keyword) throws Exception {
		return this.sqlSessionTemplate.selectOne("search.selectContentPostingCount",keyword);
	}
	@Override
	public int selectTitleContentPostingCount(String keyword) throws Exception {
		return this.sqlSessionTemplate.selectOne("search.selectTitleContentPostingCount",keyword);
	}

}
